﻿@if (Link)
{
    <a class="btn btn-primary" disabled="@_disabled" @onclick="Click">
        @ChildContent
    </a>
}
else
{
    <button class="btn btn-primary" disabled="@_disabled" @onclick="Click">
        @ChildContent
    </button>
}

@code{
    [Parameter] public RenderFragment? ChildContent { get; set; }
    [Parameter] public EventCallback<MouseEventArgs> OnClick { get; set; }

    [Parameter]public bool Link{ get; set; }

    bool _disabled;


    Task Click()
    {
        _disabled = true;
        OnClick.InvokeAsync();
        return Task.CompletedTask;
    }
}